//
//  ToolbarViewController.m
//  Toolbar
//

#import "ToolbarViewController.h"

@implementation ToolbarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	
	CGSize viewSize = self.view.frame.size;
	float toolbarHeight = 44.0;
	CGRect toolbarFrame
	= CGRectMake(0,
				 viewSize.height-toolbarHeight,
				 viewSize.width,
				 toolbarHeight);
	UIToolbar *myToolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame];
	
	myToolbar.autoresizingMask = UIViewAutoresizingFlexibleWidth
	| UIViewAutoresizingFlexibleLeftMargin
	| UIViewAutoresizingFlexibleRightMargin
	| UIViewAutoresizingFlexibleTopMargin;
	
	//myToolbar.tintColor = [UIColor redColor];
	myToolbar.translucent = YES;
	
	UIBarButtonItem *button1 = [[UIBarButtonItem alloc]
								initWithTitle:@"plain"
								style:UIBarButtonItemStylePlain
								target:nil
								action:nil];
	UIBarButtonItem *button2 = [[UIBarButtonItem alloc]
								initWithTitle:@"bordered"
								style:UIBarButtonItemStyleBordered
								target:nil
								action:nil];
	UIBarButtonItem *button3 = [[UIBarButtonItem alloc]
								initWithTitle:@"done"
								style:UIBarButtonItemStyleDone
								target:nil
								action:nil];
	
	NSArray *buttons = [[NSArray alloc]
						initWithObjects:button1,
						button2, button3, nil];
	[button1 release];
	[button2 release];
	[button3 release];
	
	[myToolbar setItems:buttons];
	
	[self.view addSubview:myToolbar];
	[myToolbar release];
}

- (void)dealloc {
    [super dealloc];
}

@end
